<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="../include/tag.jsp"%>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>数据查看</title>
    <%@include file="../include/commonFile.jsp"%>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">

</head><body>
<%@include file="../include/header.jsp"%>

<div class="index-outside">
    <%@include file="../include/sidebar.jsp"%>
    <section>
        <div class="section-main">
            <%--众筹主题--->众筹--%>
            <div class="layui-tab layui-tab-brief mt20" lay-filter="type">
                <ul class="layui-tab-title" >
                    <li class="layui-this" id="funding">众筹<span id="total_1" class="pl5">${projectNum}</span>人</li>
                    <li class="" id="representing">联合发起<span id="total_0" class="pl5">${representNum}</span>人</li>
                    <li class="" id="directPay">直接付款<span id="total_2" class="pl5">${directPayNum}</span>人</li>
                </ul>
                <div class="layui-tab-content">
                    <form class="layui-form" action="${ctx}/crowdfund/project/listForEvent.do?eventId=${projectWithAuthor.eventId}" id="myForm" method="post">
                        <input type="hidden" name="pageNo" id="pageNo" />
                        <div class="f-search-bar">
                            <div class="search-container">
                                <ul class="search-form-content">
                                    <li class="form-item"><label class="search-form-lable">众筹状态</label>
                                        <div class="check-btn-inner">
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),'','#myForm')" ${empty projectWithAuthor.isSuccess ? 'class="active"' : ''}>全部</a>
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),0,'#myForm')" ${projectWithAuthor.isSuccess == 0 ? 'class="active"' : ''}>众筹中</a>
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),1,'#myForm')" ${projectWithAuthor.isSuccess == 1 ? 'class="active"' : ''}>众筹成功</a>
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),3,'#myForm')" ${projectWithAuthor.isSuccess == 3 ? 'class="active"' : ''}>退款中</a>
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),4,'#myForm')" ${projectWithAuthor.isSuccess == 4 ? 'class="active"' : ''}>退款成功</a>
                                            <input type="hidden" name="isSuccess" value="${projectWithAuthor.isSuccess}"/>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        <div class="f-search-bar">
                            <div class="search-container">
                                <ul class="search-form-content">
                                    <li class="form-item-inline"><label class="search-form-lable" style="text-indent: 13px;">众筹者</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="authorName" autocomplete="off" class="layui-input" value="${projectWithAuthor.authorName}"
                                                   placeholder="众筹者"
                                            >
                                        </div></li>
                                    <li class="form-item-inline"><label class="search-form-lable">联系电话</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="authorMobile" autocomplete="off" class="layui-input" value="${projectWithAuthor.authorMobile}"
                                                   placeholder="联系电话"
                                            >
                                        </div>
                                    </li>
                                    <li class="form-item-inline"><label class="search-form-lable">排序方式</label>
                                        <div class="layui-input-inline">
                                            <select name="sort">
                                                <option value="0" ${projectWithAuthor.sort == 0 ? 'selected="selected"' : ''}>金额最多</option>
                                                <option value="1" ${projectWithAuthor.sort == 1 ? 'selected="selected"' : ''}>时间最近</option>
                                            </select>
                                        </div>
                                    </li>
                                </ul>
                                <ul class="search-form-content">
                                    <li class="form-item-inline"><label class="search-form-lable">筛选金额</label>

                                        <div class="layui-input-inline">
                                            <input type="number" name="amountGOE" autocomplete="off"
                                                   class="layui-input"
                                                   value="${projectWithAuthor.amountGOE}"
                                                   placeholder="最小金额">
                                        </div>-
                                        <div class="layui-input-inline">

                                            <input type="number" name="amountLOE" autocomplete="off"
                                                   class="layui-input"
                                                   value="${projectWithAuthor.amountLOE}"
                                                   placeholder="最大金额">
                                        </div>
                                    </li>
                                    <li class="form-item-inline">
                                        <div class="sub-btns">
                                            <a class="layui-btn layui-btn-danger" href="javascript:submitFunction('#myForm')">确定</a>
                                            <a class="layui-btn layui-btn-normal" href="javascript:resetFunction('#myForm')">重置</a>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="${ctx}/crowdfund/project/listForEventExport.do?eventId=${projectWithAuthor.eventId}" id="exportForm" method="post">
                    </form>
                    <div class="my-act-list-content">
                        <ul class="num">
                            <div class="l">
                                <li class="f16">众筹人数<span class="red">${page.totalCount}</span>人</li>
                                <li class="f16">总金额
                                    <span class="red">
                                        <c:if test="${totalMoney > 0}">
                                            <fmt:formatNumber pattern="#,###.##" value="${totalMoney}"/>
                                        </c:if>
                                        <c:if test="${totalMoney == 0.0}">
                                            ${totalMoney}
                                        </c:if>
                                    </span> 元
                                </li>
                                <li class="f16">退款金额
                                    <span class="red">
                                        <c:if test="${refundMoney > 0}">
                                            <fmt:formatNumber pattern="#,###.##" value="${refundMoney}"/>
                                        </c:if>
                                        <c:if test="${refundMoney == 0.0}">
                                            ${refundMoney}
                                        </c:if>
                                    </span> 元
                                </li>
                                <li class="f16">剩余金额
                                    <span class="red">
                                        <c:if test="${remainMoney > 0}">
                                            <fmt:formatNumber pattern="#,###.##" value="${remainMoney}"/>
                                        </c:if>
                                        <c:if test="${remainMoney == 0.0}">
                                            ${remainMoney}
                                        </c:if>
                                    </span> 元
                                </li>
                                <c:if test="${projectWithAuthor.isSuccess == 1}">
                                    <li class="f16">成功金额
                                        <span class="red">
                                        <c:if test="${successfulAmount > 0}">
                                            <fmt:formatNumber pattern="#,###.##" value="${successfulAmount}"/>
                                        </c:if>
                                        <c:if test="${successfulAmount == 0.0}">
                                            ${successfulAmount}
                                        </c:if>
                                    </span> 元
                                    </li>
                                </c:if>
                            </div>
                            <div class="r">
                                <li style="cursor: pointer;" class="r">
                                    <a class="layui-btn layui-btn-danger layui-btn-sm" href="javascript:txz.expireCheck('', function() { exportExcelData() })">导出EXCEL</a>
                                </li>
                            </div>
                            <p class="cl"></p>
                        </ul>
                        <div class="cl">
                            <table class="layui-table">
                                <colgroup>
                                    <col width="75px">
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                    <col width="130px">
                                    <col width="90px">
                                    <col width="90px">
                                    <col width="100px">
                                    <col width="90px">
                                    <col width="90px">
                                    <col width="90px">
                                    <col>
                                </colgroup>
                                <thead>
                                <tr>
                                    <th>序号</th>
                                    <th>众筹者</th>
                                    <th>渠道</th>
                                    <th>报名来源</th>
                                    <th>下级报名人数</th>
                                    <th>公司</th>
                                    <th>区域</th>
                                    <th>职务</th>
                                    <th>联系电话</th>
                                    <th>支持人数</th>
                                    <th>目标金额</th>
                                    <th>支持金额</th>
                                    <th>真实金额</th>
                                    <th>浏览量</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach var="directPay" items="${list}" varStatus="st">
                                    <tr>
                                        <td>${page.limit * (page.page-1) + st.count}</td>
                                        <td class="table-member" onclick="openDialogShow('用户名片','${ctx}/system/member/memberView.do?id=${directPay.authorId}','400px','470px')">
                                            <div class="member-cell">
                                                <div class="member-logo common-img">
                                                    <img src="<c:if test="${ directPay.authorLogo!= null}">${directPay.authorLogo}?imageMogr2/auto-orient/crop/126x126</c:if>" alt="" onerror="txz.errImg(this)" onload="txz.imgLoad(this)">
                                                </div>
                                                <div class="member-name ellipsis-1"><a class="blue" title="${directPay.authorName}" href="javascript:void(0);" >${directPay.authorName}</a></div>
                                            </div>
                                        </td>

                                        <td>
                                            <div class="ellipsis-1"
                                                 title="${directPay.publisher}">${directPay.publisher}</div>
                                        </td>
                                        <c:if test="${ not empty directPay.parentId}">
                                        <td class="table-member"
                                            onclick="openDialogShow('用户名片','${ctx}/system/member/memberView.do?id=${directPay.parentId}','400px','470px')">
                                            <div class="member-cell">
                                                <div class="member-logo common-img">
                                                    <img src="<c:if test="${ directPay.parentLogo!= null}">${directPay.parentLogo}?imageMogr2/auto-orient/crop/126x126</c:if>" alt="" onerror="txz.errImg(this)" onload="txz.imgLoad(this)">
                                                </div>
                                                <div class="member-name ellipsis-1"><a class="blue"
                                                                                       title="${directPay.parentName}"
                                                                                       href="javascript:void(0);">${directPay.parentName}</a>
                                                </div>
                                            </div>
                                        </td>
                                        </c:if>
                                        <c:if test="${ empty directPay.parentId}">
                                            <td></td>
                                        </c:if>
                                        <td>
                                            <a href="javascript:void(0);" class="blue ${directPay.childNum > 0 ? 'childNum' : ''} count-num"
                                               data-id="${directPay.id}" >${directPay.childNum}</a>
                                        </td>



                                        <td>
                                            <div class="ellipsis-1" title="${directPay.authorCompany}">${directPay.authorCompany}</div>
                                        </td>
                                        <td>
                                                ${directPay.cityName}
                                        </td>
                                        <td>
                                                ${directPay.authorJobTitle}
                                        </td>
                                        <td>
                                                ${directPay.authorMobile}
                                        </td>
                                        <td>
                                            <a href="javascript:void(0);" class="blue ${directPay.actualAmount > 0 ||directPay.isSuccess == 4? 'favorerNum' : ''} count-num" data-id="${directPay.id}" data-name="${directPay.authorName}">${directPay.favorerNum}</a>

                                        </td>
                                        <td>
                                                ${directPay.targetAmount}
                                        </td>
                                        <td>
                                            <a href="javascript:void(0);" class="blue ${directPay.actualAmount > 0 ||directPay.isSuccess == 4? 'actualAmount' : ''} count-num" data-id="${directPay.id}" data-name="${directPay.authorName}"> ${directPay.actualAmount}</a>

                                        </td>
                                        <td>
                                            <c:if test="${empty directPay.realTimeAmount || null == directPay.realTimeAmount}">
                                                0.0
                                            </c:if>
                                            <c:if test="${ not empty directPay.realTimeAmount || null != directPay.realTimeAmount}">
                                                ${directPay.realTimeAmount}
                                            </c:if>
                                        </td>
                                        <td>
                                                ${directPay.viewNum}
                                        </td>
                                        <td>
                                            <c:if test="${directPay.isSuccess == 0}">
                                                <span>众筹中</span>
                                            </c:if>
                                            <c:if test="${directPay.isSuccess == 1}">
                                                <span>众筹成功</span>
                                            </c:if>
                                            <c:if test="${directPay.isSuccess == 2}">
                                                <span>众筹失败</span>
                                            </c:if>
                                            <c:if test="${directPay.isSuccess == 3}">
                                                <span>退款中</span>
                                            </c:if>
                                            <c:if test="${directPay.isSuccess == 4}">
                                                <span>退款成功</span>
                                            </c:if>
                                        </td>
                                        <td  class="tb-opts">
                                            <div class="comm-opts">
                                                <a href="javascript:openDialogShow('数据查看','${ctx}/crowdfund/support/chartView.do?projectId=${directPay.id}&eventId=${projectWithAuthor.eventId}','1050px','500px')" target="_self">
                                                    数据查看
                                                </a>
                                            </div>
                                        </td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                        <div id="page_content" class="page-container"></div>
                    </div>
                </div>
            </div>
        </div><%@include file="../include/footer.jsp"%>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '众筹主题',
            href: '${ctx}/crowdfund/event/list.do'
        }, {
            name: '${crowdfundEvent.name}'
        }, {
            name: '数据查看',
            curr: true
        }],
        btns: [{
            type: 'back'
        }]
    });


    $(function () {
        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });

        layui.use(['element'], function () {
            var element = layui.element;


            element.on('tab', function (data) {
                if (data.index == 0) {
                    window.location.href = "${ctx}/crowdfund/project/listForEvent.do?eventId=${projectWithAuthor.eventId}";
                } else if (data.index == 1) {
                    window.location.href = "${ctx}/crowdfund/represen/listForEvent.do?eventId=${projectWithAuthor.eventId}";
                } else if (data.index == 2) {
                    window.location.href = "${ctx}/crowdfund/project/dpListForEvent.do?eventId=${projectWithAuthor.eventId}";
                }
            });

            element.on('tab(zc)', function (data) {
                if (data.index == 0) {
                    $('#isSuccess').val('');
                    $('#myForm').submit();
                }
                else if (data.index == 1) {
                    $('#isSuccess').val('0');
                    $('#myForm').submit();
                }
                else if (data.index == 2) {
                    $('#isSuccess').val('1');
                    $('#myForm').submit();
                }
                else if (data.index == 3) {
                    $('#isSuccess').val('3');
                    $('#myForm').submit();
                }
                else if (data.index == 4) {
                    $('#isSuccess').val('4');
                    $('#myForm').submit();
                }
            });
        });
        $('.childNum').click(function () {
            var parentId = this.dataset.id;
            <%--openDialogShow('下级报名人数','${ctx}/crowdfund/project/childList.do?parentId=' + parentId +"&targetId=${activity.id}",'800px','500px')--%>
            openDialogShow('下级报名人数', '${ctx}/crowdfund/project/childList.do?id=' + parentId, '800px', '500px')
        });
        $('.favorerNum').click(function () {
            var projectId = this.dataset.id;
            var name = this.dataset.name;
            window.location.href = '${ctx}/crowdfund/support/event/listForProjectId.do?eventId=${projectWithAuthor.eventId}&projectId=' + projectId;
        });

        $('.actualAmount').click(function () {
            var projectId = this.dataset.id;
            var name = this.dataset.name;
            window.location.href = '${ctx}/crowdfund/support/event/listForProjectId.do?eventId=${projectWithAuthor.eventId}&projectId=' + projectId;
        });
    })

    function exportExcelData() {
        layer.confirm('确认要导出Excel吗?', {
            icon: 3,
            title: '系统提示'
        }, function (index) {
            //loading层
            var loadIndex = layer.load(1, {
                shade: [0.1, '#fff'] //0.1透明度的白色背景
            });
            var url = $("#exportForm").attr("action");
            $.post(url, $("#myForm").serialize(), function (res) {
                top.layer.close(loadIndex);
                if (res.success) {
                    window.location.href = res.data;
                } else {
                    util.layerMsgError(res.description)
                }
            });
            top.layer.close(index);
        });
    }
</script>
</body>
</html>
